#include <stdio.h>
#include <stdlib.h>
#include <csp_spu.h>
#include <csp_debug.h>
#include "../../shared/poison_test.h"


int global_pid; 


int Run(){
	int pid = csp_pid();


	global_pid = csp_pid();

	int n __attribute__ ((aligned(16)));
	int poison = 0;

	n = BIRTHDAY;

	csp_channel solo2collector = 
		csp_create_channel(ONE2ONE_CHANNEL, SOLO_CHANNEL, sizeof(int));

	poison = csp_channel_write(solo2collector, &n);

	ASSERT( CHANNEL_SUCCESS == poison ); /* SUCCESS! */

	csp_poison_channel( solo2collector );

	poison = csp_channel_write(solo2collector, &n);

	ASSERT( CHANNEL_POISON == poison );


	ASSERT( pid == csp_pid() );
	ASSERT( global_pid == csp_pid() );

	printf("poison_w_solo_process terminating.\n");	

	return SOLO_RET_STATUS;
}
